package com.nativetoast

import com.facebook.react.BaseReactPackage
import com.facebook.react.bridge.NativeModule
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.module.model.ReactModuleInfo
import com.facebook.react.module.model.ReactModuleInfoProvider

class NativeToastPackage : BaseReactPackage() {
    override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? =
        if(name==NativeToast.NAME){
            NativeToast(reactContext)
        }else{
            null
        }


    override fun getReactModuleInfoProvider() = ReactModuleInfoProvider {
        mapOf(NativeToast.NAME to ReactModuleInfo(
            name = NativeToast.NAME,
            className = NativeToast.NAME,
            canOverrideExistingModule = false,
            needsEagerInit = false,
            isCxxModule = false,
            isTurboModule = true
        ))
    }
}